<?php
	$classData = $this->config->item('classes')[$this->session->userdata('class')];
	$classDataSize = sizeof($classData);

	$rankIdx = floor($this->session->userdata('wins') / $this->config->item('wins_per_rank')) - 1;
	if($rankIdx < 0) $rankIdx = 0;
	else if($rankIdx >= $classDataSize) $rankIdx = $classDataSize;

	$rankData = $classData['ranks'][$rankIdx];
	$this->session->set_userdata('my-rank', $rankData);
?>

<h1>
	Welcome!: <strong><?php echo $this->session->userdata('player_name');?></strong>
	<div id="menu">
		<ul>
			<li><a href="<?php echo base_url('index.php/admin/dashboard');?>">Dashboard</a></li> |
			<li><a href="">Tong-Its! Masters</a></li> |
			<li><a href="<?php echo base_url('index.php/admin/signout');?>">Get out!</a></li>
		</ul>
	</div>
	<br/>
	<table id="rank-info" cellspacing="0" cellpadding="0">
		<tr>
			<td style="vertical-align:bottom;">
				<img style="margin-bottom: -5px;" src="<?php echo base_url('public_html/images/'.$rankData['img'].'.png'); ?>"/>
			</td>
			<td style="vertical-align:bottom;">
				<h1 style="margin-bottom: 2px">
					<strong class="subscript">You are a
						<span class="outline" style="color: blue; font-size: 14px;"><?php echo $rankData['name']?></span>
					</strong>
				</h1>
				<strong class="subscript" style="margin-left: 15px;">
					<span><span style="font-size: 15px;">
						<?php echo $this->session->userdata('wins').'</span>/'.$this->session->userdata('loss'); ?>
					</span>
				</strong>
				<br/>
				<img id="class-img" src="<?php echo base_url('public_html/images/'.$classData['img'].'.png'); ?>" style="margin-top: 10px;"/>
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center" style="vertical-align:bottom;">
				<strong class="subscript">of Class <span class="outline" style="color: #ffcc00; font-size: 14px;"><?php echo $classData['name']?></span></strong>
			</td>
		</tr>
	</table>
</h1>

<table id="tbl-player" width="100%">
</table>



<script type="text/javascript" src="<?php echo base_url('public_html/js/jquery-1.11.0.js');?>"></script>
<script type="text/javascript">
	var BASE_URL = '<?php echo base_url();?>' + 'index.php/';
	var MY_ID = '<?php echo $this->session->userdata("id")?>';
</script>
<script type="text/javascript" src="<?php echo base_url('public_html/js/dashboard.js');?>"></script>